{extend name="pub/base2" /}
{block name="title"}
<title>漫画编辑</title>
{/block}

{block name="body"}
<article class="clearfix pd-20">
    <form action="{:url('edit')}" method="post" class="form form-horizontal" enctype="multipart/form-data">
        <input type="hidden" value="{$article.id}" name="id">
        <div class="row clearfix">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>标题：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$article.title}" name="title">
            </div>
        </div>


        <div class="row clearfix">
            <label class="form-label col-xs-4 col-sm-3">简介：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <textarea name="desc" cols="" rows="" class="textarea" dragonfly="true"
                          onKeyUp="textarealength(this,100)">{$article.desc}</textarea>
                <p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
            </div>
        </div>

        <div class="row clearfix">
            <label class="form-label col-xs-4 col-sm-3">封面：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="file" name="cover" class="input-text">
            </div>
        </div>

        <div class="row clearfix">
            <label class="form-label col-xs-4 col-sm-3">文章内容：</label>
            <div class="form-controls col-xs-8 col-sm-9">
                <script id="articleEditor" name="content" type="text/plain" style="width:100%;height:400px;"></script>
            </div>
        </div>

        <div class="row clearfix">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>关联漫画ID：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$article.book_id}" name="book_id">
            </div>
        </div>

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</article>
{/block}
{block name="script"}
<script type="text/javascript" src="/static/admin/lib/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="/static/admin/lib/ueditor/ueditor.all.min.js"> </script>
<script>
    $(function () {
        var ue = UE.getEditor('articleEditor');
        ue.ready(function(){
            //设置编辑器的内容
            ue.setContent('{$content}');
        });
        $("form").validate({
            rules: {
                title: {
                    required: true,
                    minlength: 1,
                    maxlength: 100
                },
                content:{
                    required: true,
                },
                book_id:{
                    required: true,
                    digital:true
                }
            },
            onkeyup: false,
            focusCleanup: false,
            success:"valid"
        });
    });

</script>
{/block}